<template>
  <PullRefresh @refresh="updateItems">
    <div slot="pullRefreshSlot">
      <div class="snsmain">
        <MessageItem
          :items="item"
          v-for="(item, index) in items"
          :key="'newmessageitem_' + index"
        >
          <div class="snsmain_messagemain" slot="message">
            <MessageTemplate :item="item" :type="type"></MessageTemplate>
          </div>
        </MessageItem>
      </div>
    </div>
  </PullRefresh>
  <!-- <van-pull-refresh
    v-model="isLoading"
    @refresh="onRefresh"
    :pulling-text="this.$t('lang.下拉即可刷新')"
    :loosing-text="this.$t('lang.释放即可刷新')"
    :loading-text="this.$t('lang.加载中')"
  >
    <div class="snsmain">
      <MessageItem
        :items="item"
        v-for="(item, index) in items"
        :key="'newmessageitem_' + index"
      >
        <div class="snsmain_messagemain" slot="message">
          <MessageTemplate :item="item" :type="type"></MessageTemplate>
        </div>
      </MessageItem>
    </div>
  </van-pull-refresh> -->
</template>
<script>
export default {
  name: "snsMain",
  data() {
    return {
      items: [],
      isLoading: false,
      type: 3,
    };
  },
  components: {
    PullRefresh: () =>
      import(
        /* webpackChunkName:"pullRefresh" */ "../../components/common/pullRefresh.vue"
      ),
    FollowButton: () =>
      import(
        /* webpackChunkName: "followButton" */ "../../components/common/followButton"
      ),
    MessageTemplate: () =>
      import(
        /* webpackChunkName: "messageTemplate" */ "../../components/message/messageTemplate"
      ),
    MessageItem: () =>
      import(
        /* webpackChunkName: "messageItem" */ "../../components/common/messageItem"
      ),
    SnsReplyInputs: () =>
      import(
        /* webpackChunkName: "snsReplyInputs" */ "../../components/common/snsReplyInputs"
      ),
  },
  created() {
    this.updateItems(1).then(() => {});
  },
  methods: {
    updateItems(pageNum, callback) {
      let that = this;
      return new Promise((resolve, reject) => {
        that.items = [
          {
            userHead: "",
            nickName: "undefined",
            userId: "0123456",
            type: 3,
            content: {
              follower: [
                { userHead: "", nickName: "undefined", userId: "0123456" },
              ],
              message:
                "fadfadsfadsfadfa,adfadsfa,dsfadf.ad,adfasdfadsfa,adfa,df,a.adfafdfad.",
              followTime: 1596094606575,
            },
            reply: {
              message: "fadfad,adf.",
              followTime: 1596094606575,
            },
          },
          {
            userHead: "",
            nickName: "undefined",
            userId: "0123456",
            type: 3,
            content: {
              follower: [
                { userHead: "", nickName: "undefined", userId: "0123456" },
              ],
              message: "adfadfdfad,adfadfadfad,adfadsfadfadfadf.",
              followTime: 1596094606575,
            },
          },
          {
            userHead: "",
            nickName: "undefined",
            userId: "0123456",
            type: 3,
            content: {
              follower: [
                { userHead: "", nickName: "undefined", userId: "0123456" },
              ],
              message: "adfadfad,adfadfad。",
              followTime: 1596094606575,
            },
          },
        ];
        callback && callback();
        resolve();
      });
    },
  },
};
</script>
<style lang="less">
@base: 23.44rem;
.snsmain {
  padding: 10 / @base;
  .snsmain_messagemain {
  }
}
</style>
